package _17_Inheritance.cars;

public class Car 
{
	protected String model;
	private double maxSpeed;
	protected double currentSpeed;
	protected int currentGear;
	protected int numberOfDoors;
	private int idNumber;
	protected boolean isSportCar;
	protected Person owner;
	
	protected String type = "Just a car";
	
	Car()
	{
		
	}
	
	Car(double maxSpeed)
	{
		this.maxSpeed = maxSpeed;
	}
	
	protected void changeOwner(Person newOwner)
	{
		this.owner = newOwner;
	}
	
	protected void startEngine()
	{
		System.out.println("Engine starts!");
	}
	
	public void changeGear(int gear)
	{
		this.currentGear = gear;
	}
	
	public void accelerate(double speed)
	{
		if(currentSpeed + speed > maxSpeed)
		{
			currentSpeed = maxSpeed;
		}
		else
		{
			this.currentSpeed = speed;
			System.out.println("Now driving at " + currentSpeed + " km/h.");
		}
	}
	
	public String toString()
	{
		return "Car Model: " + model + ", max speed is: " + maxSpeed;
	}
	
}
